package com.py.pythink.controller;

import com.py.pythink.config.SystemConfig;
import com.py.pythink.service.intf.OssLogService;
import com.py.pythink.vo.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

@RestController
@CrossOrigin
@RequestMapping("/api/oss/")
@Api(value = "",tags = "实现0SS的上传和查询")
public class OssLogController {
    @Autowired
    private OssLogService service;
    @PostMapping("upload.do")
    public R upload(MultipartFile file, HttpServletRequest request){
        return service.upload(file,request.getHeader(SystemConfig.USER_TOKEN));
    }
    @PostMapping("all.do")
    public R all(){
        return service.all();
    }
    @PostMapping("uploadimg.do")
    public R uploadImg(MultipartFile img, HttpServletRequest request){
        return service.uploadImg(img,request.getHeader(SystemConfig.USER_TOKEN));
    }
}
